package com.goods.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * 分类模块WEB层，控制器
 * @author ASUS
 *
 */

import com.goods.pojo.Category;
import com.goods.service.CategoryService;
@Controller
@RequestMapping("/CategoryController")
public class CategoryController {
	
	@Resource
	private CategoryService categoryServiceImpl;
	
	/**
	 * 显示所有分类
	 */
	@RequestMapping("/findCategoryAll")
	public String findCategoryAll(HttpServletRequest req, HttpServletResponse resp){
		System.out.println("=============================================");
		/*
		 * 1. 通过service得到所有的分类
		 * 2. 保存到request中，转发到left.jsp
		 */
		List<Category> parents = categoryServiceImpl.findAll();
		req.setAttribute("parents", parents);
		return "/jsps/left.jsp";
	}

	
}
